package com.zys.el.user.util.ChatGPT;

import com.theokanning.openai.completion.CompletionRequest;
import com.theokanning.openai.service.OpenAiService;

public class ChatGptDemo {

    public static void main(String[] args) {

        String token = "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";//System.getenv("OPENAI_TOKEN");

        OpenAiService service = new OpenAiService(token);
        CompletionRequest completionRequest = CompletionRequest.builder()
                .model("text-davinci-003")
                .prompt("今天天气怎么样？")
                .temperature(0.5)
                .maxTokens(2048)
                .topP(1D)
                .frequencyPenalty(0D)
                .presencePenalty(0D)
                .build();
        service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
    }
}